import java.sql.*;

public class Jdbc_Factory {

	private static Connection conn;
	private static final String DRIVER = "oracle.jdbc.driver.OracleDriver";
//	private static final String URL = "jdbc:oracle:thin:@127.0.0.1:1521:XE";
//	private static final String USERNAME = "xia";
//	private static final String PASSWORD = "jia";
	private static final String URL =  "jdbc:oracle:thin:@ (DESCRIPTION = (ADDRESS = (PROTOCOL =TCP)"
		+ "(HOST = 10.1.7.102)(PORT = 1521)) (LOAD_BALANCE = yes)(CONNECT_DATA = (SERVICE_NAME = tctest) ) )";
	private static final String USERNAME = "gou";
	private static final String PASSWORD = "gou123";

	public static Connection getConnection() {
		try {
			Class.forName(DRIVER);

			if (conn == null) {
				conn = DriverManager.getConnection(URL, USERNAME, PASSWORD);
				System.out.println("________________"+conn);
				conn.setAutoCommit(false);
			}
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return conn;
	
	}

}
